package rmi;

import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class JavaRmiClient {
    public static void main(String[] args) throws RemoteException, NotBoundException {
        Registry registry = LocateRegistry.getRegistry("127.0.0.1",8182);
        Sendble sendble = (Sendble) registry.lookup("sendble");
        for (;;){
            Request request = new Request();
            request.message = "request message";
            System.out.println("send ".concat(request.message));
            Response response = sendble.getResponse(request);
            System.out.println("receive ".concat(response.result));

            try {
                Thread.currentThread().sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
